<?php

class Admin_Form_AddZip extends Zend_Form {

    public function init() {
        $this->setMethod('post');

        #name
        $name = new Zend_Form_Element_Text('codes');
        $name->setLabel('Zipcode:')
                ->setRequired(true);

        #city id
        $cityDb = new Ads_Model_City();
        $cityArray = $cityDb->fetchAll();
        $city = new Zend_Form_Element_Select('city');
        $city->setLabel('City Name:')
                ->setRequired(true)
                ->addValidator('Int')
                ->addMultiOption(-1, 'Select City');
        foreach ($cityArray as $value) {
            $city->addMultiOption($value->id, $value->name);
        }

        #submit
        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Add New Zipcode')
                ->setAttribs(array('class' => 'btn btn-success'));

        $this->addElements(array($name, $city, $submit));
    }

}

